package com.myPlaneGame.obj;

import com.myPlaneGame.GameCreate;
import com.myPlaneGame.Utils.GameUtils;

import java.awt.*;

public class DoubleShellObj extends GameObj{
    public DoubleShellObj() {
        super();
    }

    public DoubleShellObj(Image img, int width, int height, int x, int y, double speed, GameCreate frame) {
        super(img, width, height, x, y, speed, frame);
    }

    public DoubleShellObj(Image img, int x, int y, double speed) {
        super(img, x, y, speed);
    }

    public DoubleShellObj(int x, int y) {
        super(x, y);
    }

    @Override
    public void paintSelf(Graphics g) {
        super.paintSelf(g);
        y-=speed;
        //清除子弹跃出游戏窗口的数据（降低游戏页面绘制的压力）
        if(y<50){
            this.x=-1000;
            this.y=-1000;
            GameUtils.removeList.add(this);
        }
        //重新刷新游戏数据
        if(GameCreate.state==3||GameCreate.state==4){
            this.x=-1000;
            this.y=-1000;
            GameUtils.removeList.add(this);
        }
    }

    @Override
    public Rectangle getRec() {
        return super.getRec();
    }
}
